# -*- encoding: utf-8 -*-
'''
@File    :   test.py    
@Contact :
@Author  :     ypy

@Modify Time      @Author    @Version    @Desciption
------------      -------    --------    -----------
2021/2/23 21:29   ypy      1.0         测试单元
'''

import unittest

#需设置当前的环境变量，该环境变量只在本程序有效，导入models单元不会报错
import os, django
os.environ['DJANGO_SETTINGS_MODULE'] = 'lottery_V2.settings'
django.setup()

import DLT.models as models
from django.core.exceptions import ObjectDoesNotExist

class TestStringMethods(unittest.TestCase):

    def test_upper(self):
        try:
            lottery = models.phase_data.objects.all().filter(date__startswith = '2020')
            print(lottery)
        except ObjectDoesNotExist:
            print(lottery)


if __name__ == '__main__':
    unittest.main()
